<?php

	class classSQL
	{
		private $hostname;
		private $database;
		private $username;
		private $password;
		private $connection;
		private $resultado;
		
		function  __construct($hostname, $database, $username, $password)
		{
			$this -> hostname = $hostname;
			$this -> database = $database;
			$this -> username = $username;
			$this -> password = $password;
			
			$this -> connection = mysql_connect($this -> hostname, $this -> username, $this -> password) or trigger_error(mysql_error(),E_USER_ERROR); 
			mysql_select_db($this -> database, $this -> connection);
	
		}
		
		
		public function exec_orden_sql($query)
		{
			mysql_query($query, $this -> connection) or die(mysql_error());
		}
		
		
		public function exec_consulta_sql($query)
		{
			$this -> resultado = mysql_query($query, $this -> connection) or die(mysql_error());
			return ($this -> resultado);
		}
		
		
		public function close_connection()
		{
			mysql_close($this -> connection);
		}
		
		
		public function sql_fetch_assoc()
		{
			return (mysql_fetch_assoc($this -> resultado));
		}
		
		
		public function getNumRows()
		{
			return (mysql_num_rows($this -> resultado));
		}
		
		
	}	/* class classSQL */
	
	
	
	class classPropDB
	{
		private $hostname;
		private $database;
		private $username;
		private $password;
		
		function  __construct($hostname, $database, $username, $password) 
		{
			$this -> hostname = $hostname;
			$this -> database = $database;
			$this -> username = $username;
			$this -> password = $password;
		}
		
		public function getHostname()
		{
			return $this -> hostname;
		}
		
		
		public function getDatabaseName()
		{
			return $this -> database;
		}
		
		
		
		public function getUserName()
		{
			return $this -> username;
		}
		
		
		public function getPassword()
		{
			return $this -> password;
		}
		
	}	/* class classPropDB */
	
	
	
	class classDATPHPLog extends classPropDB
	{
		function  __construct() 
		{
			parent::__construct("localhost", "db_aplicaciones", "root", "");
		}
		
	}	/* class classDATPHPLog extends classPropDB */

	
	
	
	
	class classCotizaPropDB extends classPropDB
	{
		function  __construct($amb) 
		{
			parent::__construct("localhost", "db_cotiza_".$amb, "root", "");
		}
		
	}	/* class classCotizaPropDB extends classPropDB */

?>

